-
Notifications
You must be signed in to change notification settings - Fork 14
feat: set vote fiat value #566
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
bfe6e45
to
ddee8cc
Compare
ddee8cc
to
6aecdde
Compare
feat: add index to vp_value fix: handle high precision computation perf: fix: handle error fix: increase last vote cb
6aecdde
to
4383ded
Compare
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements vote fiat value calculation functionality by adding a new vp_value
column to the votes table to store the calculated fiat value of each vote. The value is computed by multiplying each strategy's voting power by its corresponding fiat value from the proposal.
- Added
vp_value
column to votes table with appropriate database schema changes - Implemented
getVoteValue
helper function to calculate vote values based on strategy values - Updated vote writer to compute and store vote values with error handling fallback
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
test/schema.sql | Adds vp_value column and index to votes table schema |
src/helpers/entityValue.ts | New helper function to calculate vote value from proposal and vote data |
src/writer/vote.ts | Integrates vote value calculation into vote processing with error handling |
src/helpers/actions.ts | Parses vp_value_by_strategy from proposal data |
test/unit/helpers/entityValue.test.ts | Comprehensive test coverage for vote value calculation |
.env.example | Adds LAST_CB environment variable configuration |
Vote Value Computation
Closes https://github.com/snapshot-labs/workflow/issues/614
This PR assigns a fiat value to a vote, when available
Key Features
🎯 Core Enhancement
vp_value
column to votes table for storing fiat values (13 digits, 3 decimal precision, see https://github.com/snapshot-labs/workflow/issues/618)💰 Value Calculation Logic
cb
column will not be updated🔧 Technical Implementation
src/helpers/entityValue.ts
vp_value
column with appropriate precision (DECIMAL(13,3))Database Changes
vp_value
DECIMAL(13,3) column to votes tableTesting
Create the column
vp_value
vp_value_by_strategy
)vp_value
column (voting power x strategy value)